﻿@model Pottery.Frontend.ViewModels.CartViewModel
@using Pottery.Frontend.Resources

@{
    ViewBag.Title = Cart.YourCart;
}

@{
    if (Model.Cart.Lines.Count<Pottery.Frontend.Models.CartLine>() != 0)
    {
        foreach (var line in Model.Cart.Lines)
        {     
    <div class="productItem">
        <div class="divProdImg">
            <img src="@Url.Content("~/Content/images/PictMock.jpg")" alt="@line.Product.Name" class="productImg" />
        </div>
        <div class="divProdImg width">
            <p>@Html.ActionLink(@line.Product.Name, "ViewProductDetails", "Product", new { productId = line.Product.Id }, null)</p>
            <p><span class="titleProduct">@Cart.Price </span>@line.Product.Price @Cart.MockCurrency</p>
            <p>
                <span class="titleProduct">@Cart.Quantity </span>
                <input type="number" value="@line.Quantity" name ="number"
                    onmousemove="document.getElementById('Edit').style.display='block'; return false;" />
                @Cart.Item
            </p>
        </div>

        @using (Html.BeginForm("EditLineInCart", "Cart",
                new { productId = line.Product.Id, quantity = "document.getElementById('number').value".AsInt() }))
        {
            <input style="display: block;" type="submit" value="@Cart.EditLineInCart" name ="Edit" />              
        }

        @using (Html.BeginForm("RemoveFromCart", "Cart",
                new { productId = line.Product.Id, returnUrl = Request.Url.PathAndQuery }))
        {
            <input type="submit" value="@Cart.RemoveFromCart" />   
        }
    </div>
        }
    }
}
<hr />
<h1>@Cart.Total @Model.Total.ToString() @Cart.MockCurrency</h1>
@using (Html.BeginForm("Create", "Order",
                new { cart = Model.Cart, total = Model.Total }))
{
    <input type="submit" value="@Cart.CreateOrder" />   
}



